package idiet.service;

import idiet.bean.FoodIngredientElement;
import idiet.dao.hibernate.FoodIngredientElementDao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("foodIngredientElementService")
public class FoodIngredientElementService {
	@Autowired
	private FoodIngredientElementDao foodIngredientELementDao;
	
	public FoodIngredientElement getFoodIngredientElement(int id){
		return this.foodIngredientELementDao.getFoodIngredientElement(id);
	}
	public List<FoodIngredientElement> getFoodIngredientElements(String elementName){
		if(elementName==null){
			return this.foodIngredientELementDao.getFoodIngredientElements();
		}else{
			return this.foodIngredientELementDao.getFoodIngredientElements(elementName);
		}
	}
	public void createFoodIngredientElement(FoodIngredientElement element){
		this.foodIngredientELementDao.createFoodIngredientElement(element);
	}
	public void updateFoodIngredientElement(FoodIngredientElement element){
		this.foodIngredientELementDao.updateFoodIngredientElement(element);
	}
	public void deleteFoodIngredientElement(FoodIngredientElement element){
		this.foodIngredientELementDao.deleteFoodIngredientElement(element);
	}
}
